Feat: Enhance NetworkManager EventTargetParser targets #930
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix NetworkManager EventTargetParser for Neutron event payload structure
Summary
Fixes the
EventTargetParserinNetworkManagerto correctly extract resource IDs from Neutron events. The current implementation assumes a flat payload structure with a directresource_idfield, but Neutron uses nested payloads where resources are contained in type-specific objects.Problem
Current behavior:
Actual Neutron payload structure:
{ "payload": { "network": { "id": "b39598c6-e36e-4d8c-82c9-d295addcf82c", "tenant_id": "fd2f0bf534504696a8fb62ca84f4e191", ... } } }Solution
Key Changes
1. Added
resource_typehelper:Extracts
"network"from"network.create.end"automatically.2. Added intelligent
resource_idextraction:payload.dig("network", "id")3. Replaced
if/elsifchain withcasestatement:4. Enhanced tenant ID extraction:
Searches multiple locations for tenant/project ID in nested structures.
Testing
Manual testing with real Neutron events via AMQP:
Updated spec tests: